{template header}


{template sidebar}

<!-- artile begin -->
<div class="article">
{template title}

    <!--{if  $a == 'index' ||  $a =='search_Goods' }-->
<form class="form-search" action="{$this->url($c, 'search_Goods', $this->get())}">
    <table>
        <tr><td class="td1" width="20%">入库单号：</td>
            <td>

                <div class="input-append">
                    <input type="text" name="key" id="inStockNo" value="{$a == 'search_Goods'? $result['key']  : '' }" class="span2 search-query" placeholder="请输入入库单号" />
                    <button type="button" class="btn search">搜索</button>
                </div>
            </td >
        </tr>
    </table>

    <table cellpadding="1" cellspacing="1" width="100%" border="0">
        <tr>
            <td><input type="checkbox" name="id"  width="5%" value="{$t['Name']}" /></td>
            <th width="30%">商品编号</th>
            <th width="15%">数量</th>
            <th width="15%">颜色信息</th>
            <th width="15%" >尺码信息</th>
            <th width="20%">操作</th>

        </tr>
        <!--{if $res}-->
        <!--{loop $res $val}-->
        <tr>
            <td><input type="checkbox" name="id" width="5%" value="{$val['id']}" /></td>
            <td>{$val['goodsNo']}  </td>
            <td>{$val['goodsNumber']}</td>
            <td>{$val['color']}</td>
            <td>{$val['size']}</td>
            <td class="operate">
                <a href="{$this->url($c,'editGoods',array('id'=>$val['id'],'inOutStockNo'=>$res['key']))}">编辑</a>
                <a title="删除商品" class="del" href="{$this->url($c,'del',array('id'=>$val['id']))}">删除</a>
            </td>

        </tr>
        <!--{/loop}-->
        <!--{else}-->
        <tr>
            <td colspan="5">没有数据记录！</td>
        </tr>
        <!--{/if}-->
        <!--{if $pager}-->
        <!--分页开始-->
        <tr>
            <td colspan="6">
                <div class="page">{$pager}</div>
            </td>
        </tr>
        <!--分页结束-->
        <!--{/if}-->

        <tr>
            <td colspan="4" class="td4">
                <a title="添加商品" class="btn btn-success " id="addGoods"  href="{$this->url('inGoodsEdit')}">添加商品</a>
            </td>
        </tr>
        <script type="text/javascript">
            $("#addGoods").click(function () {
                var orderNo = $("#inStockNo").val();
                var url = $(this).attr('href');
                if(orderNo)
                     url = url +"&a=addGoods"+ "&inOutStockNo=" + encodeURI(orderNo);
                else
                {
                      alert("入库单号为空");

                }
                window.location = url;

                return false;
            });
        </script>
    </table>
</form>

    <!--{/if}-->


<!--{if $a ==  'addGoods' ||  $a =='editGoods' }-->
<form method="post" action="{$this->url($c, 'saveGoods', array('id' => $result['id'],'type' => $type) )}">
    <table cellpadding="1" cellspacing="1" width="100%" border="0">
        <tr>
            <td class="td1">商品编号：</td>
            <td class="td2" colspan="4">
                <input type="text" name="goodsNo" value="{$a == 'editGoods'? $result['goodsNo']  : '' }"   {echo $result['editMode']  == '1'? readonly : ''} " />
            </td>

        </tr>
        <tr>
            <td class="td1">入库类型：</td>
            <td class="td2" colspan="4" >
                <select name="inStockType"   >
                    <option value="1" {echo $result['inOutStyle']  == '1'? selected : ''}  />新增入库</option>
                    <option value="2" {echo $result['inOutStyle']  == '2'? selected : ''}  />换货入库</option>
                    <option value="3" {echo $result['inOutStyle']  == '3'? selected : ''}  />补货入库</option>
                </select>
            </td>
        </tr>


        <tr>
            <td class="td1">货号：</td>
            <td class="td2" colspan="4">
                <input type="text" name="clothNo" value="{$a == 'editGoods'  ? $result['clothNo'] : ''} "/>
            </td>

        </tr>
        <tr>
            <td class="td1">数量：</td>
            <td class="td2" colspan="4">
                <input type="text" name="goodsNumber" value="{$a == 'editGoods'  ?$result['goodsNumber']   : ''}"  />
            </td>
        </tr>


        <tr>
            <td class="td1">颜色：</td>
            <!--{if $result['editMode']  == '1'}-->
            <td class="td2" colspan="4">
                <input type="text" name="color" value="{$a == 'editGoods'  ?$result['color']   : ''}"  readonly =true/>
            </td>
            <!--{else}-->
            <td class="td2" colspan="4">
                <!-- <input type="text" name="sort" placeholder="请输入供货商经营品类" value="{$a == 'edit' ? $result['sort'] : ''}" />  -->
                <!--{loop $this->color $k $v}-->
                <!--{if  $k % 6==0 }-->
                <br>
                <!--{/if}-->
                <input type="checkbox"  name="color[]" value="{$k}" {echo $k == $result['color'] ? 'checked':''} />{$v} &nbsp;  &nbsp; &nbsp;
                <!--{/loop}-->

            </td>
            <!--{/if}-->
        </tr>
        <tr>
            <td class="td1">尺码：</td>
            <!--{if $result['editMode']  == '1'}-->
            <td class="td2" colspan="4">
                <input type="text" name="size" value="{$a == 'editGoods'  ?$result['size']   : ''}"  readonly=true/>
            </td>
            <!--{else}-->
            <td class="td2" colspan="4">
                <!-- <input type="text" name="sort" placeholder="请输入供货商经营品类" value="{$a == 'edit' ? $result['sort'] : ''}" />  -->
                <!--{loop $this->size $k $v}-->
                <!--{if  $k % 6==0 }-->
                <br>
                <!--{/if}-->
                <input type="checkbox" name="size[]" value="{$k}" {echo $k == $result['size'] ? 'checked':''}/>{$v} &nbsp; &nbsp;
                <!--{/loop}-->

            </td>
            <!--{/if}-->


            <input type="hidden" name="inOutStockNo" value="{$result['inOutStockNo']}" />
            <input type="hidden" name="stockNo" value="{$result['stockNo']}" />
            <input type="hidden" name="editMode" value="{$result['editMode']}" />

        </tr>

        <tr>
            <td class="td1">进货价格：</td>
            <td class="td2" colspan="4">
                <input type="text" name="costPrice" value="{$a == 'editGoods'  ?$result['costPrice']   : ''}" />
            </td>
        </tr>
        <script type="text/javascript">
            $( function () {
                $( ":checkbox" ).click( function () {
                    var color_len = $( 'input[name="color[]"]:checked' ).length;
                    var size_len = $( 'input[name="size[]"]:checked' ).length;
                    //alert( "color:" + color_len + " size:" + size_len );
                    if ( color_len > 1 && size_len > 1 ) {
                        $.jBox.tip( "同一款衣服不能同时选择多个颜色和多个尺寸!" );
                        $( 'input[name="size[]"]' ).attr( 'checked', false ); // 让尺码全部成未选中
                        $( 'input[name="color[]"]' ).attr( 'checked', false ); // 让尺码全部成未选中
                        return false;
                    }
                });
            });
        </script>
        <tr>
            <td  colspan="2" class="td2">
                <a title="保存" class="btn btn-success save" href="{$this->url($c)}">保 存</a>
            </td>
            <td colspan="2" class="td2">
                <a title="重置" class="btn btn-success save" href="{$this->url($c)}">重 置</a>
            </td>
        </tr>
    </table>
</form>
<!--{/if}-->










</div>
<!-- artile end -->
{template footer}
